#include "../../GL/libExt/libExt.h"
#include "Textures/Sampler.h"
#include <windows.h>
namespace gname
{
	

	/*void Sampler::ApplySampler()
	{
		glTexParameteri(target, GL_TEXTURE_MAG_FILTER, magFilter);
        glTexParameteri(target, GL_TEXTURE_MIN_FILTER, minFilter);
        
		
		glTexParameteri(target, GL_TEXTURE_WRAP_S, wrapS);
        glTexParameteri(target, GL_TEXTURE_WRAP_T, wrapT);
		glTexParameteri(target, GL_TEXTURE_WRAP_R, wrapR);

		glTexParameterf(target, GL_TEXTURE_MAX_ANISOTROPY_EXT, anisotropyLevel);
	}*/

	void Sampler::SetTextureFilter(int	filter, int texTarget)
	{
		TextureFilter	minF = FT_LINEAR;
	    TextureFilter	magF = FT_LINEAR;
		target               = texTarget;
	int	Aniso = 0;
	switch(filter)
	{
		case FT_NONE:
			minF	= FT_NEAREST;
			magF	= FT_NEAREST;
			break;
		case TFILTER_BILINEAR_NOMIPMAP:
			minF	= FT_LINEAR ;
			magF	= FT_LINEAR ;
			break;	
		case TFILTER_BILINEAR:
			magF	= FT_LINEAR ;
			minF	= FT_LINEAR_MIPMAP_NEAREST;
			break;			
		case TFILTER_TRILINEAR:
			magF	= FT_LINEAR;
			minF	= FT_LINEAR_MIPMAP_LINEAR;
			break;
		case TFILTER_ANISO_2X:
			magF	= FT_LINEAR;
			minF	= FT_LINEAR_MIPMAP_LINEAR;
			anisotropyLevel	= 2;
			break;
		case TFILTER_ANISO_4X:
			magF	= FT_LINEAR;
			minF	= FT_LINEAR_MIPMAP_LINEAR ;
			anisotropyLevel	= 4;
			break;
		case TFILTER_ANISO_8X:
			magF	= FT_LINEAR;
			minF	= FT_LINEAR_MIPMAP_LINEAR ;
			anisotropyLevel	= 8;
			break;
		case TFILTER_ANISO_16X:
			magF	= FT_LINEAR;
			minF	= FT_LINEAR_MIPMAP_LINEAR;
			anisotropyLevel	= 16;
			break;
		default:
			return;
	}

	if(minFilter!=minF)
	{ 
		
		minFilter = minF;
	}

	if(magFilter!=magF)
	{ 
		
		magFilter = magF;
	}


	}
}